﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProgramForm.ascx.cs" Inherits="AcademicPlanner.Presentation.Views.Shared.ProgramForm" %>
<%@ Import Namespace="AcademicPlanner.Framework.Libraries.Mvc" %>
<%@ Import Namespace="AcademicPlanner.Framework.Helpers" %>
<%@ Import Namespace="AcademicPlanner.Presentation" %>
<%@ Import Namespace="AcademicPlanner.Presentation" %>
<%@ Import Namespace="AcademicPlanner.Presentation.Views.Shared" %>
<%@ Import Namespace="AcademicPlanner.Domain.Models" %>

<% if (!Model.IsSub)
   { %>
		<div class="form yui-skin-sam">
		<% Begin(); %>
<% } %>

<% if (!string.IsNullOrEmpty(Title))
   { %>
		<fieldset><legend><%= Html.Encode(Title) %></legend>
<% } %>

<% if (!Model.IsSub)
   { %>
		<%= WidgetHelper.FormErrorsBlock("", Model.Id + "Errors", "hidden")%>
<% } %>



<% if (Model.Scenario.Equals(ProgramFormScenario.CREATE)
		|| Model.Scenario.Equals(ProgramFormScenario.EDIT))
   {
	%>
		<div class="rows-wrapper">
			<div class="row">
				<div class="cell label">
					<%= Html.Label(GetFieldName("Name"), Html.Encode(Tr(Labels.Get("Name", "Program"))), true)%>
				</div>
				<div class="cell">
					<%= Html.TextField(GetFieldName("Name"), NameValue)%>
				</div>
			</div>
			<div class="row">
				<div class="cell label">
					<%= Html.Label(GetFieldName("MinimumCredits"), Html.Encode(Tr(Labels.Get("MinimumCredits", "Program"))), true)%>
				</div>
				<div class="cell">
					<%= Html.TextField(GetFieldName("MinimumCredits"), MinimumCreditsValue)%>
				</div>
				<div class="cell">
					<span class="hint"><%= Html.Encode(string.Format(Tr("greater than {0}"),
					                   					Program.MINIMUMCREDITS_MIN_VALUE)) %></span>
				</div>
			</div>
			<div class="row">
				<div class="cell label">
					<%= Html.Label(GetFieldName("RequiredCourses"), Html.Encode(Tr(Labels.Get("RequiredCourses", "Program"))))%>
				</div>
				<div class="cell">
					<%	if (SelectRequiredCoursesModel.Courses.Count > 0)
						{ %>
						<% Html.RenderPartial("CoursesControl", SelectRequiredCoursesModel); %>
					<%	} 
						else 
						{ %>
							<%= Html.ActionLink(Tr("Click here"), "List", "Courses", new { pId = Model.PlanId }, new { }) %>
							to create Courses first!
						<% } %>
				</div>
			</div>
			<div class="row">
				<div class="cell label">
					<%= Html.Label(GetFieldName("RecommendedCourses"), Html.Encode(Tr(Labels.Get("RecommendedCourses", "Program"))))%>
				</div>
				<div class="cell">
					<%	if (SelectRecommendedCoursesModel.Courses.Count > 0)
						{ %>
						<% Html.RenderPartial("CoursesControl", SelectRecommendedCoursesModel); %>
					<%	} 
						else 
						{ %>
							<%= Html.ActionLink(Tr("Click here"), "List", "Courses", new { pId = Model.PlanId }, new { })%>
							to create Courses first!
						<% } %>
				</div>
			</div>
		</div>
<% } %>



<% if (!Model.IsSub)
   { %>
		<div class="rows-wrapper action">
			<div class="row">
				<div class="cell label">
					&nbsp;
				</div>
				<div class="cell">
					<%= Html.SubmitButton("submitForm", Html.Encode(SubmitButtonValue), "") %>
				</div>
			</div>
		</div>
<% } %>


<% if (!string.IsNullOrEmpty(Title))
   { %>
		</fieldset>
<% } %>


<% if (!Model.IsSub)
   { %>
		<% End(); %>
		</div>
<% } %>